import fly from 'flyio'

const baseUrl = "http://localhost:5000"

const fetch = async (url,method,data,params,headers) => {
    return fly.request(baseUrl+url,
        data,
        {
            method:method,
            timeout:5000
        })
        .then(response => {
            console.log(response.data)
            return response.data
        })
        .catch(error => {
            console.log(error)
            throw error
        })
}

export default fetch